package org.hackystat.project;

import static org.junit.Assert.*;
import org.hackystat.utilities.stacktrace.StackTrace;
import org.hackystat.utilities.time.period.Day;
import org.junit.Test;

/**
 * Test cases for the DailyEffort bean.
 * @author Cam Moore
 *
 */
public class TestDailyEffort {

  /**
   * Tests t he DailyEffort bean.
   */
  @Test
  public void testDailyEffort() {
    try {
      Day today = Day.getInstance();
      Day fixed = Day.getInstance("27-Dec-2007");
      DailyEffort effort = new DailyEffort(today, 100);
      assertNotNull("Got null effort", effort);
      assertEquals("Got wrong day", today, effort.getDay());
      assertEquals("Got wrong effort", 100l, effort.getEffort());
      effort.setDay(fixed);
      effort.setEffort(200);
      assertEquals("Got wrong day", fixed, effort.getDay());
      assertEquals("Got wrong effort", 200l, effort.getEffort());
      assertEquals("Got wrong toString", "27-Dec-2007:200", effort.toString());
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      fail("Error: " + StackTrace.toString(e));
    }
  }

}
